package class16;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;

public class MyGraph {

    public static class Graph<T> {
        public HashMap<T, Node<T>> nodes;
        public HashSet<Edge<T>> edges;

        public Graph() {
            this.nodes = new HashMap<>();
            this.edges = new HashSet<>();
        }
    }

    public static class Node<T> {
        public T value;
        public int in, out;
        public ArrayList<Node<T>> nexts;
        public ArrayList<Edge<T>> edges;

        public Node(T value) {
            this.value = value;
            this.in = this.out = 0;
            this.nexts = new ArrayList<>();
            this.edges = new ArrayList<>();
        }
    }

    public static class Edge<T> {
        public T weight;
        public Node<T> from, to;

        public Edge(T weight, Node<T> from, Node<T> to) {
            this.weight = weight;
            this.from = from;
            this.to = to;
        }
    }

}